-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roles test #366
Roles test #366
Conversation
Cool. But - is this in the main release yet? I had to branch the wordpresspcl projec tto get things working: #266 |
this should be possible all along, it just wasn't documented. can you try this? To retreive users with roles, you'll need to set the UsersQueryBuilder queryBuilder = new()
{
// required for roles to be loaded
Context = Context.Edit
};
List<User> users = await _clientAuth.Users.QueryAsync(queryBuilder, true); |
Hi @ThomasPe , I confirmed that the fix/suggestion works on the current 2.1 version. So... that way I can at least use NuGet instead of my one off branch now. I think that to save the frustration of anyone using the API, you may need to shield this context=edit from the caller because I assume people want all the fields by default. (in the next version of WordPressPCL). There is so many ways to do it. The easiest way may be to check if UseAuth is true, and if so, automatically add Context=Edit to the call. Or you could add a third param on top of embed/useauth and call the third one contextedit=true. I think the point of the C# api is to shield some of these word press nuances. |
adds test to validate user queries with context=edit will return user roles as expected
also removes all IEnumerables in favor of Lists (as they are materialized already anyways).